import { createApp , h} from 'vue'

import App from './App.vue'
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import * as ElIcons from '@element-plus/icons-vue'
import './style.css'

import { getElementLabelLine } from 'element-tree-line';
import 'element-tree-line/dist/style.css';

import Layui from '@layui/layui-vue'
import '@layui/layui-vue/lib/index.css'
import { createRouter,createWebHistory } from "vue-router"; 


import Vant from 'vant';
import 'vant/lib/index.css';


const modulesFiles = import.meta.globEager('./views/*/*.vue')
const routes =  [ 
    { path:'/',name:'/',	component: () => import("./views/Templete.vue") },
    { path: '/lux-doc', name: '/lux-doc',component: () => import("./views/lux/doc.vue") },
    { path: '/lux-host', name: '/lux-host',component: () => import("./views/lux/host.vue") },
    { path: '/lux-link-all', name: '/lux-link-all',component: () => import("./views/lux/link-all.vue") },
    { path: '/lux-link', name: '/lux-link',component: () => import("./views/lux/link.vue") },
    { path: '/lux-note', name: '/lux-note',component: () => import("./views/lux/note.vue") },
    { path: '/lux-pateimg', name: '/lux-pateimg',component: () => import("./views/lux/pateimg.vue") },
    { path: '/lux-project-table', name: '/lux-project-table',component: () => import("./views/lux/project-table.vue") },
    { path: '/lux-qrcode', name: '/lux-qrcode',component: () => import("./views/lux/qrcode.vue") },
    { path: '/lux-stock-list', name: '/lux-stock-list',component: () => import("./views/lux/stock-list.vue") },
    { path: '/lux-stock-table', name: '/lux-stock-table',component: () => import("./views/lux/stock-table.vue") },
    { path: '/lux-util', name: '/lux-util',component: () => import("./views/lux/util.vue") },
]
// for (const path in modulesFiles) {
// 	console.log(path);
// 	routes.push({ 
//     path: "/" + path.replace("./views/",'').replace("/",'-').replace(".vue",''), 
//     name: "/" + path.replace("./views/",'').replace("/",'-').replace(".vue",''), 
// 	component: () => import(path) })
// } 



console.log(routes);
const router = createRouter({
    history:createWebHistory(),routes
})

const app = createApp(App)
for (const iconName in ElIcons) {
    app.component(iconName, ElIcons[iconName])
}
const ElementLabelLine = getElementLabelLine(h);
app.component(ElementLabelLine.name, ElementLabelLine);

app.use(ElementPlus).use(Layui).use(Vant).use(router).mount('#app');
